import Mock from 'mockjs';
// 1.x 导入方式
import { mockFetch } from './mockjs-fetch';
// 2.x 导入方式
import { isDevelopment } from '@bastet/utils'
import scenes from "./widget.json";
import widget from "./widget.json";


if (isDevelopment) {
  Mock.XHR._settings.debug = false
  mockFetch(Mock);

  Mock.setup({
    timeout: '200-400', // mockFetch支持 mockjs 已有的 timeout 设置项
    debug: true, // mockFetch新增的设置项，如果开启，请求时会打印一些日志
  } as any);

  Mock.mock('http://localhost:4003/api/scenes', {
    code: 0,
    data: scenes,
  });

  Mock.mock('http://localhost:4003/api/widget', {
    code: 0,
    data: widget,
  });
}
